package com.yonyou.pmclouds.safetyrectification.service.rmiimpl;

import com.yonyou.pmclouds.basecom.exception.BusinessException;
import com.yonyou.pmclouds.basecom.ref.itf.RefCodeConst;
import com.yonyou.pmclouds.basecom.ref.itf.ReferenceCheckOfBusiness;
import com.yonyou.pmclouds.problemlog.entity.ProblemLogVO;
import com.yonyou.pmclouds.safetyrectification.service.ISafetyRectificationQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class ReferenceCheckOfSafetyRectification implements ReferenceCheckOfBusiness{
    @Autowired
    private ISafetyRectificationQuery query;
    @Override
    public String[] getReferenceCode() {
        return new String[]{RefCodeConst.PROJECTPART};
}

    @Override
    public boolean checkReferenced(String bdCode, String[] keys) throws BusinessException {
        String code = null;
        if(RefCodeConst.PROJECTPART.equals(bdCode)) {
            code = ProblemLogVO.PK_PROJECTPART;
        } else {
            throw new BusinessException("安全整改暂未引用该档案!");
       }
       return query.queryRefByIds(code, keys);
    }

}
